//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import Foundation
import SotoCore

extension CloudTrail {
    // MARK: Enums

    public enum EventCategory: String, CustomStringConvertible, Codable {
        case insight
        public var description: String { return self.rawValue }
    }

    public enum InsightType: String, CustomStringConvertible, Codable {
        case apicallrateinsight = "ApiCallRateInsight"
        public var description: String { return self.rawValue }
    }

    public enum LookupAttributeKey: String, CustomStringConvertible, Codable {
        case accesskeyid = "AccessKeyId"
        case eventid = "EventId"
        case eventname = "EventName"
        case eventsource = "EventSource"
        case readonly = "ReadOnly"
        case resourcename = "ResourceName"
        case resourcetype = "ResourceType"
        case username = "Username"
        public var description: String { return self.rawValue }
    }

    public enum ReadWriteType: String, CustomStringConvertible, Codable {
        case all = "All"
        case readonly = "ReadOnly"
        case writeonly = "WriteOnly"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AddTagsRequest: AWSEncodableShape {
        /// Specifies the ARN of the trail to which one or more tags will be added. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let resourceId: String
        /// Contains a list of CloudTrail tags, up to a limit of 50
        public let tagsList: [Tag]?

        public init(resourceId: String, tagsList: [Tag]? = nil) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct AddTagsResponse: AWSDecodableShape {
        public init() {}
    }

    public struct AdvancedEventSelector: AWSEncodableShape & AWSDecodableShape {
        /// Contains all selector statements in an advanced event selector.
        public let fieldSelectors: [AdvancedFieldSelector]
        /// An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".
        public let name: String?

        public init(fieldSelectors: [AdvancedFieldSelector], name: String? = nil) {
            self.fieldSelectors = fieldSelectors
            self.name = name
        }

        public func validate(name: String) throws {
            try self.fieldSelectors.forEach {
                try $0.validate(name: "\(name).fieldSelectors[]")
            }
            try self.validate(self.fieldSelectors, name: "fieldSelectors", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, max: 1000)
            try self.validate(self.name, name: "name", parent: name, min: 0)
            try self.validate(self.name, name: "name", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case fieldSelectors = "FieldSelectors"
            case name = "Name"
        }
    }

    public struct AdvancedFieldSelector: AWSEncodableShape & AWSDecodableShape {
        ///  An operator that includes events that match the last few characters of the event record field specified as the value of Field.
        public let endsWith: [String]?
        ///  An operator that includes events that match the exact value of the event record field specified as the value of Field. This is the only valid operator that you can use with the readOnly, eventCategory, and resources.type fields.
        public let equals: [String]?
        ///  A field in an event record on which to filter events to be logged. Supported fields include readOnly, eventCategory, eventSource (for management events), eventName, resources.type, and resources.ARN.      readOnly  - Optional. Can be set to Equals a value of true or false. A value of false logs both read and write events.     eventSource  - For filtering management events only. This can be set only to NotEquals kms.amazonaws.com.     eventName  - Can use any operator. You can use it to ﬁlter in or ﬁlter out any data event logged to CloudTrail, such as PutBucket. You can have multiple values for this ﬁeld, separated by commas.     eventCategory  - This is required. It must be set to Equals, and the value must be Management or Data.     resources.type  - This ﬁeld is required. resources.type can only use the Equals operator, and the value can be one of the following: AWS::S3::Object, AWS::Lambda::Function, or AWS::S3Outposts::Object. You can have only one resources.type ﬁeld per selector. To log data events on more than one resource type, add another selector.     resources.ARN  - You can use any operator with resources.ARN, but if you use Equals or NotEquals, the value must exactly match the ARN of a valid resource of the type you've speciﬁed in the template as the value of resources.type. For example, if resources.type equals AWS::S3::Object, the ARN must be in one of the following formats. The trailing slash is intentional; do not exclude it.    arn:partition:s3:::bucket_name/     arn:partition:s3:::bucket_name/object_or_file_name/    When resources.type equals AWS::Lambda::Function, and the operator is set to Equals or NotEquals, the ARN must be in the following format:    arn:partition:lambda:region:account_ID:function:function_name    When resources.type equals AWS::S3Outposts::Object, and the operator is set to Equals or NotEquals, the ARN must be in the following format:    arn:partition:s3-outposts:region:&gt;account_ID:object_path
        public let field: String
        ///  An operator that excludes events that match the last few characters of the event record field specified as the value of Field.
        public let notEndsWith: [String]?
        ///  An operator that excludes events that match the exact value of the event record field specified as the value of Field.
        public let notEquals: [String]?
        ///  An operator that excludes events that match the first few characters of the event record field specified as the value of Field.
        public let notStartsWith: [String]?
        ///  An operator that includes events that match the first few characters of the event record field specified as the value of Field.
        public let startsWith: [String]?

        public init(endsWith: [String]? = nil, equals: [String]? = nil, field: String, notEndsWith: [String]? = nil, notEquals: [String]? = nil, notStartsWith: [String]? = nil, startsWith: [String]? = nil) {
            self.endsWith = endsWith
            self.equals = equals
            self.field = field
            self.notEndsWith = notEndsWith
            self.notEquals = notEquals
            self.notStartsWith = notStartsWith
            self.startsWith = startsWith
        }

        public func validate(name: String) throws {
            try self.endsWith?.forEach {
                try validate($0, name: "endsWith[]", parent: name, max: 2048)
                try validate($0, name: "endsWith[]", parent: name, min: 1)
                try validate($0, name: "endsWith[]", parent: name, pattern: ".+")
            }
            try self.validate(self.endsWith, name: "endsWith", parent: name, min: 1)
            try self.equals?.forEach {
                try validate($0, name: "equals[]", parent: name, max: 2048)
                try validate($0, name: "equals[]", parent: name, min: 1)
                try validate($0, name: "equals[]", parent: name, pattern: ".+")
            }
            try self.validate(self.equals, name: "equals", parent: name, min: 1)
            try self.validate(self.field, name: "field", parent: name, max: 1000)
            try self.validate(self.field, name: "field", parent: name, min: 1)
            try self.validate(self.field, name: "field", parent: name, pattern: "[\\w|\\d|\\.|_]+")
            try self.notEndsWith?.forEach {
                try validate($0, name: "notEndsWith[]", parent: name, max: 2048)
                try validate($0, name: "notEndsWith[]", parent: name, min: 1)
                try validate($0, name: "notEndsWith[]", parent: name, pattern: ".+")
            }
            try self.validate(self.notEndsWith, name: "notEndsWith", parent: name, min: 1)
            try self.notEquals?.forEach {
                try validate($0, name: "notEquals[]", parent: name, max: 2048)
                try validate($0, name: "notEquals[]", parent: name, min: 1)
                try validate($0, name: "notEquals[]", parent: name, pattern: ".+")
            }
            try self.validate(self.notEquals, name: "notEquals", parent: name, min: 1)
            try self.notStartsWith?.forEach {
                try validate($0, name: "notStartsWith[]", parent: name, max: 2048)
                try validate($0, name: "notStartsWith[]", parent: name, min: 1)
                try validate($0, name: "notStartsWith[]", parent: name, pattern: ".+")
            }
            try self.validate(self.notStartsWith, name: "notStartsWith", parent: name, min: 1)
            try self.startsWith?.forEach {
                try validate($0, name: "startsWith[]", parent: name, max: 2048)
                try validate($0, name: "startsWith[]", parent: name, min: 1)
                try validate($0, name: "startsWith[]", parent: name, pattern: ".+")
            }
            try self.validate(self.startsWith, name: "startsWith", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case endsWith = "EndsWith"
            case equals = "Equals"
            case field = "Field"
            case notEndsWith = "NotEndsWith"
            case notEquals = "NotEquals"
            case notStartsWith = "NotStartsWith"
            case startsWith = "StartsWith"
        }
    }

    public struct CreateTrailRequest: AWSEncodableShape {
        /// Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. Not required unless you specify CloudWatchLogsRoleArn.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether log file integrity validation is enabled. The default is false.  When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail will not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
        public let enableLogFileValidation: Bool?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail is created in the current region or in all regions. The default is false, which creates a trail only in the region where you are signed in. As a best practice, consider creating trails that log events in all regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is created for all accounts in an organization in AWS Organizations, or only for the current AWS account. The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the master account for an organization in AWS Organizations.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. Examples:   alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012   12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies the name of the trail. The name must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid.   Not be in IP address format (for example, 192.168.5.4)
        public let name: String
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.
        public let s3BucketName: String
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.
        public let snsTopicName: String?
        public let tagsList: [Tag]?

        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, enableLogFileValidation: Bool? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, name: String, s3BucketName: String, s3KeyPrefix: String? = nil, snsTopicName: String? = nil, tagsList: [Tag]? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.enableLogFileValidation = enableLogFileValidation
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicName = snsTopicName
            self.tagsList = tagsList
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case enableLogFileValidation = "EnableLogFileValidation"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicName = "SnsTopicName"
            case tagsList = "TagsList"
        }
    }

    public struct CreateTrailResponse: AWSDecodableShape {
        /// Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists in one region or in all regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file integrity validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Specifies the name of the trail.
        public let name: String?
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// Specifies the ARN of the trail that was created. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case trailARN = "TrailARN"
        }
    }

    public struct DataResource: AWSEncodableShape & AWSDecodableShape {
        /// The resource type in which you want to log data events. You can specify AWS::S3::Object or AWS::Lambda::Function resources. The AWS::S3Outposts::Object resource type is not valid in basic event selectors. To log data events on this resource type, use advanced event selectors.
        public let type: String?
        /// An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified objects.   To log data events for all objects in all S3 buckets in your AWS account, specify the prefix as arn:aws:s3:::.   This will also enable logging of data event activity performed by any user or role in your AWS account, even if that activity is performed on a bucket that belongs to another AWS account.     To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as arn:aws:s3:::bucket-1/. The trail logs data events for all objects in this S3 bucket.   To log data events for specific objects, specify the S3 bucket and object prefix such as arn:aws:s3:::bucket-1/example-images. The trail logs data events for objects in this S3 bucket that match the prefix.   To log data events for all functions in your AWS account, specify the prefix as arn:aws:lambda.  This will also enable logging of Invoke activity performed by any user or role in your AWS account, even if that activity is performed on a function that belongs to another AWS account.     To log data events for a specific Lambda function, specify the function ARN.  Lambda function ARNs are exact. For example, if you specify a function ARN arn:aws:lambda:us-west-2:111111111111:function:helloworld, data events will only be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld. They will not be logged for arn:aws:lambda:us-west-2:111111111111:function:helloworld2.
        public let values: [String]?

        public init(type: String? = nil, values: [String]? = nil) {
            self.type = type
            self.values = values
        }

        private enum CodingKeys: String, CodingKey {
            case type = "Type"
            case values = "Values"
        }
    }

    public struct DeleteTrailRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail to be deleted. The format of a trail ARN is: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct DeleteTrailResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DescribeTrailsRequest: AWSEncodableShape {
        /// Specifies whether to include shadow trails in the response. A shadow trail is the replication in a region of a trail that was created in a different region, or in the case of an organization trail, the replication of an organization trail in member accounts. If you do not include shadow trails, organization trails in a member account and region replication trails will not be returned. The default is true.
        public let includeShadowTrails: Bool?
        /// Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail  If an empty list is specified, information for the trail in the current region is returned.   If an empty list is specified and IncludeShadowTrails is false, then information for all trails in the current region is returned.   If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current region and any associated shadow trails in other regions is returned.    If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current region. To return information about a trail in another region, you must specify its trail ARN.
        public let trailNameList: [String]?

        public init(includeShadowTrails: Bool? = nil, trailNameList: [String]? = nil) {
            self.includeShadowTrails = includeShadowTrails
            self.trailNameList = trailNameList
        }

        private enum CodingKeys: String, CodingKey {
            case includeShadowTrails
            case trailNameList
        }
    }

    public struct DescribeTrailsResponse: AWSDecodableShape {
        /// The list of trail objects. Trail objects with string values are only returned if values for the objects exist in a trail's configuration. For example, SNSTopicName and SNSTopicARN are only returned in results if a trail is configured to send SNS notifications. Similarly, KMSKeyId only appears in results if a trail's log files are encrypted with AWS KMS-managed keys.
        public let trailList: [Trail]?

        public init(trailList: [Trail]? = nil) {
            self.trailList = trailList
        }

        private enum CodingKeys: String, CodingKey {
            case trailList
        }
    }

    public struct Event: AWSDecodableShape {
        /// The AWS access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials.
        public let accessKeyId: String?
        /// A JSON string that contains a representation of the event returned.
        public let cloudTrailEvent: String?
        /// The CloudTrail ID of the event returned.
        public let eventId: String?
        /// The name of the event returned.
        public let eventName: String?
        /// The AWS service that the request was made to.
        public let eventSource: String?
        /// The date and time of the event returned.
        public let eventTime: Date?
        /// Information about whether the event is a write event or a read event.
        public let readOnly: String?
        /// A list of resources referenced by the event returned.
        public let resources: [Resource]?
        /// A user name or role name of the requester that called the API in the event returned.
        public let username: String?

        public init(accessKeyId: String? = nil, cloudTrailEvent: String? = nil, eventId: String? = nil, eventName: String? = nil, eventSource: String? = nil, eventTime: Date? = nil, readOnly: String? = nil, resources: [Resource]? = nil, username: String? = nil) {
            self.accessKeyId = accessKeyId
            self.cloudTrailEvent = cloudTrailEvent
            self.eventId = eventId
            self.eventName = eventName
            self.eventSource = eventSource
            self.eventTime = eventTime
            self.readOnly = readOnly
            self.resources = resources
            self.username = username
        }

        private enum CodingKeys: String, CodingKey {
            case accessKeyId = "AccessKeyId"
            case cloudTrailEvent = "CloudTrailEvent"
            case eventId = "EventId"
            case eventName = "EventName"
            case eventSource = "EventSource"
            case eventTime = "EventTime"
            case readOnly = "ReadOnly"
            case resources = "Resources"
            case username = "Username"
        }
    }

    public struct EventSelector: AWSEncodableShape & AWSDecodableShape {
        /// CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events.  For more information, see Data Events and Limits in AWS CloudTrail in the AWS CloudTrail User Guide.
        public let dataResources: [DataResource]?
        /// An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out AWS Key Management Service events by containing "kms.amazonaws.com". By default, ExcludeManagementEventSources is empty, and AWS KMS events are included in events that are logged to your trail.
        public let excludeManagementEventSources: [String]?
        /// Specify if you want your event selector to include management events for your trail.  For more information, see Management Events in the AWS CloudTrail User Guide. By default, the value is true. The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same region. For more information about CloudTrail pricing, see AWS CloudTrail Pricing.
        public let includeManagementEvents: Bool?
        /// Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 GetConsoleOutput is a read-only API operation and RunInstances is a write-only API operation.  By default, the value is All.
        public let readWriteType: ReadWriteType?

        public init(dataResources: [DataResource]? = nil, excludeManagementEventSources: [String]? = nil, includeManagementEvents: Bool? = nil, readWriteType: ReadWriteType? = nil) {
            self.dataResources = dataResources
            self.excludeManagementEventSources = excludeManagementEventSources
            self.includeManagementEvents = includeManagementEvents
            self.readWriteType = readWriteType
        }

        private enum CodingKeys: String, CodingKey {
            case dataResources = "DataResources"
            case excludeManagementEventSources = "ExcludeManagementEventSources"
            case includeManagementEvents = "IncludeManagementEvents"
            case readWriteType = "ReadWriteType"
        }
    }

    public struct GetEventSelectorsRequest: AWSEncodableShape {
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailName: String

        public init(trailName: String) {
            self.trailName = trailName
        }

        private enum CodingKeys: String, CodingKey {
            case trailName = "TrailName"
        }
    }

    public struct GetEventSelectorsResponse: AWSDecodableShape {
        ///  The advanced event selectors that are configured for the trail.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// The event selectors that are configured for the trail.
        public let eventSelectors: [EventSelector]?
        /// The specified trail ARN that has the event selectors.
        public let trailARN: String?

        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailARN: String? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct GetInsightSelectorsRequest: AWSEncodableShape {
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailName: String

        public init(trailName: String) {
            self.trailName = trailName
        }

        private enum CodingKeys: String, CodingKey {
            case trailName = "TrailName"
        }
    }

    public struct GetInsightSelectorsResponse: AWSDecodableShape {
        /// A JSON string that contains the insight types you want to log on a trail. In this release, only ApiCallRateInsight is supported as an insight type.
        public let insightSelectors: [InsightSelector]?
        /// The Amazon Resource Name (ARN) of a trail for which you want to get Insights selectors.
        public let trailARN: String?

        public init(insightSelectors: [InsightSelector]? = nil, trailARN: String? = nil) {
            self.insightSelectors = insightSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case insightSelectors = "InsightSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct GetTrailRequest: AWSEncodableShape {
        /// The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information.
        public let name: String

        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct GetTrailResponse: AWSDecodableShape {
        public let trail: Trail?

        public init(trail: Trail? = nil) {
            self.trail = trail
        }

        private enum CodingKeys: String, CodingKey {
            case trail = "Trail"
        }
    }

    public struct GetTrailStatusRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which you are requesting status. To get the status of a shadow trail (a replication of the trail in another region), you must specify its ARN. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct GetTrailStatusResponse: AWSDecodableShape {
        /// Whether the CloudTrail is currently logging AWS API calls.
        public let isLogging: Bool?
        /// Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs.
        public let latestCloudWatchLogsDeliveryError: String?
        /// Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs.
        public let latestCloudWatchLogsDeliveryTime: Date?
        /// This field is no longer in use.
        public let latestDeliveryAttemptSucceeded: String?
        /// This field is no longer in use.
        public let latestDeliveryAttemptTime: String?
        /// Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver log files to the designated bucket. For more information see the topic Error Responses in the Amazon S3 API Reference.   This error occurs only when there is a problem with the destination S3 bucket and will not occur for timeouts. To resolve the issue, create a new bucket and call UpdateTrail to specify the new bucket, or fix the existing objects so that CloudTrail can again write to the bucket.
        public let latestDeliveryError: String?
        /// Specifies the date and time that CloudTrail last delivered log files to an account's Amazon S3 bucket.
        public let latestDeliveryTime: Date?
        /// Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver a digest file to the designated bucket. For more information see the topic Error Responses in the Amazon S3 API Reference.   This error occurs only when there is a problem with the destination S3 bucket and will not occur for timeouts. To resolve the issue, create a new bucket and call UpdateTrail to specify the new bucket, or fix the existing objects so that CloudTrail can again write to the bucket.
        public let latestDigestDeliveryError: String?
        /// Specifies the date and time that CloudTrail last delivered a digest file to an account's Amazon S3 bucket.
        public let latestDigestDeliveryTime: Date?
        /// This field is no longer in use.
        public let latestNotificationAttemptSucceeded: String?
        /// This field is no longer in use.
        public let latestNotificationAttemptTime: String?
        /// Displays any Amazon SNS error that CloudTrail encountered when attempting to send a notification. For more information about Amazon SNS errors, see the Amazon SNS Developer Guide.
        public let latestNotificationError: String?
        /// Specifies the date and time of the most recent Amazon SNS notification that CloudTrail has written a new log file to an account's Amazon S3 bucket.
        public let latestNotificationTime: Date?
        /// Specifies the most recent date and time when CloudTrail started recording API calls for an AWS account.
        public let startLoggingTime: Date?
        /// Specifies the most recent date and time when CloudTrail stopped recording API calls for an AWS account.
        public let stopLoggingTime: Date?
        /// This field is no longer in use.
        public let timeLoggingStarted: String?
        /// This field is no longer in use.
        public let timeLoggingStopped: String?

        public init(isLogging: Bool? = nil, latestCloudWatchLogsDeliveryError: String? = nil, latestCloudWatchLogsDeliveryTime: Date? = nil, latestDeliveryAttemptSucceeded: String? = nil, latestDeliveryAttemptTime: String? = nil, latestDeliveryError: String? = nil, latestDeliveryTime: Date? = nil, latestDigestDeliveryError: String? = nil, latestDigestDeliveryTime: Date? = nil, latestNotificationAttemptSucceeded: String? = nil, latestNotificationAttemptTime: String? = nil, latestNotificationError: String? = nil, latestNotificationTime: Date? = nil, startLoggingTime: Date? = nil, stopLoggingTime: Date? = nil, timeLoggingStarted: String? = nil, timeLoggingStopped: String? = nil) {
            self.isLogging = isLogging
            self.latestCloudWatchLogsDeliveryError = latestCloudWatchLogsDeliveryError
            self.latestCloudWatchLogsDeliveryTime = latestCloudWatchLogsDeliveryTime
            self.latestDeliveryAttemptSucceeded = latestDeliveryAttemptSucceeded
            self.latestDeliveryAttemptTime = latestDeliveryAttemptTime
            self.latestDeliveryError = latestDeliveryError
            self.latestDeliveryTime = latestDeliveryTime
            self.latestDigestDeliveryError = latestDigestDeliveryError
            self.latestDigestDeliveryTime = latestDigestDeliveryTime
            self.latestNotificationAttemptSucceeded = latestNotificationAttemptSucceeded
            self.latestNotificationAttemptTime = latestNotificationAttemptTime
            self.latestNotificationError = latestNotificationError
            self.latestNotificationTime = latestNotificationTime
            self.startLoggingTime = startLoggingTime
            self.stopLoggingTime = stopLoggingTime
            self.timeLoggingStarted = timeLoggingStarted
            self.timeLoggingStopped = timeLoggingStopped
        }

        private enum CodingKeys: String, CodingKey {
            case isLogging = "IsLogging"
            case latestCloudWatchLogsDeliveryError = "LatestCloudWatchLogsDeliveryError"
            case latestCloudWatchLogsDeliveryTime = "LatestCloudWatchLogsDeliveryTime"
            case latestDeliveryAttemptSucceeded = "LatestDeliveryAttemptSucceeded"
            case latestDeliveryAttemptTime = "LatestDeliveryAttemptTime"
            case latestDeliveryError = "LatestDeliveryError"
            case latestDeliveryTime = "LatestDeliveryTime"
            case latestDigestDeliveryError = "LatestDigestDeliveryError"
            case latestDigestDeliveryTime = "LatestDigestDeliveryTime"
            case latestNotificationAttemptSucceeded = "LatestNotificationAttemptSucceeded"
            case latestNotificationAttemptTime = "LatestNotificationAttemptTime"
            case latestNotificationError = "LatestNotificationError"
            case latestNotificationTime = "LatestNotificationTime"
            case startLoggingTime = "StartLoggingTime"
            case stopLoggingTime = "StopLoggingTime"
            case timeLoggingStarted = "TimeLoggingStarted"
            case timeLoggingStopped = "TimeLoggingStopped"
        }
    }

    public struct InsightSelector: AWSEncodableShape & AWSDecodableShape {
        /// The type of insights to log on a trail. In this release, only ApiCallRateInsight is supported as an insight type.
        public let insightType: InsightType?

        public init(insightType: InsightType? = nil) {
            self.insightType = insightType
        }

        private enum CodingKeys: String, CodingKey {
            case insightType = "InsightType"
        }
    }

    public struct ListPublicKeysRequest: AWSEncodableShape {
        /// Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used.
        public let endTime: Date?
        /// Reserved for future use.
        public let nextToken: String?
        /// Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned.
        public let startTime: Date?

        public init(endTime: Date? = nil, nextToken: String? = nil, startTime: Date? = nil) {
            self.endTime = endTime
            self.nextToken = nextToken
            self.startTime = startTime
        }

        private enum CodingKeys: String, CodingKey {
            case endTime = "EndTime"
            case nextToken = "NextToken"
            case startTime = "StartTime"
        }
    }

    public struct ListPublicKeysResponse: AWSDecodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// Contains an array of PublicKey objects.  The returned public keys may have validity time ranges that overlap.
        public let publicKeyList: [PublicKey]?

        public init(nextToken: String? = nil, publicKeyList: [PublicKey]? = nil) {
            self.nextToken = nextToken
            self.publicKeyList = publicKeyList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case publicKeyList = "PublicKeyList"
        }
    }

    public struct ListTagsRequest: AWSEncodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// Specifies a list of trail ARNs whose tags will be listed. The list has a limit of 20 ARNs. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let resourceIdList: [String]

        public init(nextToken: String? = nil, resourceIdList: [String]) {
            self.nextToken = nextToken
            self.resourceIdList = resourceIdList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case resourceIdList = "ResourceIdList"
        }
    }

    public struct ListTagsResponse: AWSDecodableShape {
        /// Reserved for future use.
        public let nextToken: String?
        /// A list of resource tags.
        public let resourceTagList: [ResourceTag]?

        public init(nextToken: String? = nil, resourceTagList: [ResourceTag]? = nil) {
            self.nextToken = nextToken
            self.resourceTagList = resourceTagList
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case resourceTagList = "ResourceTagList"
        }
    }

    public struct ListTrailsRequest: AWSEncodableShape {
        /// The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?

        public init(nextToken: String? = nil) {
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
        }
    }

    public struct ListTrailsResponse: AWSDecodableShape {
        /// The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?
        /// Returns the name, ARN, and home region of trails in the current account.
        public let trails: [TrailInfo]?

        public init(nextToken: String? = nil, trails: [TrailInfo]? = nil) {
            self.nextToken = nextToken
            self.trails = trails
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case trails = "Trails"
        }
    }

    public struct LookupAttribute: AWSEncodableShape {
        /// Specifies an attribute on which to filter the events returned.
        public let attributeKey: LookupAttributeKey
        /// Specifies a value for the specified AttributeKey.
        public let attributeValue: String

        public init(attributeKey: LookupAttributeKey, attributeValue: String) {
            self.attributeKey = attributeKey
            self.attributeValue = attributeValue
        }

        private enum CodingKeys: String, CodingKey {
            case attributeKey = "AttributeKey"
            case attributeValue = "AttributeValue"
        }
    }

    public struct LookupEventsRequest: AWSEncodableShape {
        /// Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned.
        public let endTime: Date?
        /// Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify insight as the value of EventCategory, no Insights events are returned.
        public let eventCategory: EventCategory?
        /// Contains a list of lookup attributes. Currently the list can contain only one item.
        public let lookupAttributes: [LookupAttribute]?
        /// The number of events to return. Possible values are 1 through 50. The default is 50.
        public let maxResults: Int?
        /// The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?
        /// Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned.
        public let startTime: Date?

        public init(endTime: Date? = nil, eventCategory: EventCategory? = nil, lookupAttributes: [LookupAttribute]? = nil, maxResults: Int? = nil, nextToken: String? = nil, startTime: Date? = nil) {
            self.endTime = endTime
            self.eventCategory = eventCategory
            self.lookupAttributes = lookupAttributes
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.startTime = startTime
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 50)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case endTime = "EndTime"
            case eventCategory = "EventCategory"
            case lookupAttributes = "LookupAttributes"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case startTime = "StartTime"
        }
    }

    public struct LookupEventsResponse: AWSDecodableShape {
        /// A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first.
        public let events: [Event]?
        /// The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters.
        public let nextToken: String?

        public init(events: [Event]? = nil, nextToken: String? = nil) {
            self.events = events
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case events = "Events"
            case nextToken = "NextToken"
        }
    }

    public struct PublicKey: AWSDecodableShape {
        /// The fingerprint of the public key.
        public let fingerprint: String?
        /// The ending time of validity of the public key.
        public let validityEndTime: Date?
        /// The starting time of validity of the public key.
        public let validityStartTime: Date?
        /// The DER encoded public key value in PKCS#1 format.
        public let value: Data?

        public init(fingerprint: String? = nil, validityEndTime: Date? = nil, validityStartTime: Date? = nil, value: Data? = nil) {
            self.fingerprint = fingerprint
            self.validityEndTime = validityEndTime
            self.validityStartTime = validityStartTime
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case fingerprint = "Fingerprint"
            case validityEndTime = "ValidityEndTime"
            case validityStartTime = "ValidityStartTime"
            case value = "Value"
        }
    }

    public struct PutEventSelectorsRequest: AWSEncodableShape {
        ///  Specifies the settings for advanced event selectors. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors, but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events for trails in the AWS CloudTrail User Guide.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// Specifies the settings for your event selectors. You can configure up to five event selectors for a trail. You can use either EventSelectors or AdvancedEventSelectors in a PutEventSelectors request, but not both. If you apply EventSelectors to a trail, any existing AdvancedEventSelectors are overwritten.
        public let eventSelectors: [EventSelector]?
        /// Specifies the name of the trail or trail ARN. If you specify a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid.   Not be in IP address format (for example, 192.168.5.4)   If you specify a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailName: String

        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailName: String) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailName = trailName
        }

        public func validate(name: String) throws {
            try self.advancedEventSelectors?.forEach {
                try $0.validate(name: "\(name).advancedEventSelectors[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailName = "TrailName"
        }
    }

    public struct PutEventSelectorsResponse: AWSDecodableShape {
        /// Specifies the advanced event selectors configured for your trail.
        public let advancedEventSelectors: [AdvancedEventSelector]?
        /// Specifies the event selectors configured for your trail.
        public let eventSelectors: [EventSelector]?
        /// Specifies the ARN of the trail that was updated with event selectors. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        public init(advancedEventSelectors: [AdvancedEventSelector]? = nil, eventSelectors: [EventSelector]? = nil, trailARN: String? = nil) {
            self.advancedEventSelectors = advancedEventSelectors
            self.eventSelectors = eventSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case advancedEventSelectors = "AdvancedEventSelectors"
            case eventSelectors = "EventSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct PutInsightSelectorsRequest: AWSEncodableShape {
        /// A JSON string that contains the insight types you want to log on a trail. In this release, only ApiCallRateInsight is supported as an insight type.
        public let insightSelectors: [InsightSelector]
        /// The name of the CloudTrail trail for which you want to change or add Insights selectors.
        public let trailName: String

        public init(insightSelectors: [InsightSelector], trailName: String) {
            self.insightSelectors = insightSelectors
            self.trailName = trailName
        }

        private enum CodingKeys: String, CodingKey {
            case insightSelectors = "InsightSelectors"
            case trailName = "TrailName"
        }
    }

    public struct PutInsightSelectorsResponse: AWSDecodableShape {
        /// A JSON string that contains the insight types you want to log on a trail. In this release, only ApiCallRateInsight is supported as an insight type.
        public let insightSelectors: [InsightSelector]?
        /// The Amazon Resource Name (ARN) of a trail for which you want to change or add Insights selectors.
        public let trailARN: String?

        public init(insightSelectors: [InsightSelector]? = nil, trailARN: String? = nil) {
            self.insightSelectors = insightSelectors
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case insightSelectors = "InsightSelectors"
            case trailARN = "TrailARN"
        }
    }

    public struct RemoveTagsRequest: AWSEncodableShape {
        /// Specifies the ARN of the trail from which tags should be removed. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let resourceId: String
        /// Specifies a list of tags to be removed.
        public let tagsList: [Tag]?

        public init(resourceId: String, tagsList: [Tag]? = nil) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct RemoveTagsResponse: AWSDecodableShape {
        public init() {}
    }

    public struct Resource: AWSDecodableShape {
        /// The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto-scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance.
        public let resourceName: String?
        /// The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: Instance for EC2, Trail for CloudTrail, DBInstance for RDS, and AccessKey for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events.
        public let resourceType: String?

        public init(resourceName: String? = nil, resourceType: String? = nil) {
            self.resourceName = resourceName
            self.resourceType = resourceType
        }

        private enum CodingKeys: String, CodingKey {
            case resourceName = "ResourceName"
            case resourceType = "ResourceType"
        }
    }

    public struct ResourceTag: AWSDecodableShape {
        /// Specifies the ARN of the resource.
        public let resourceId: String?
        /// A list of tags.
        public let tagsList: [Tag]?

        public init(resourceId: String? = nil, tagsList: [Tag]? = nil) {
            self.resourceId = resourceId
            self.tagsList = tagsList
        }

        private enum CodingKeys: String, CodingKey {
            case resourceId = "ResourceId"
            case tagsList = "TagsList"
        }
    }

    public struct StartLoggingRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs AWS API calls. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct StartLoggingResponse: AWSDecodableShape {
        public init() {}
    }

    public struct StopLoggingRequest: AWSEncodableShape {
        /// Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging AWS API calls. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String

        public init(name: String) {
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
        }
    }

    public struct StopLoggingResponse: AWSDecodableShape {
        public init() {}
    }

    public struct Tag: AWSEncodableShape & AWSDecodableShape {
        /// The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.
        public let key: String
        /// The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.
        public let value: String?

        public init(key: String, value: String? = nil) {
            self.key = key
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case key = "Key"
            case value = "Value"
        }
    }

    public struct Trail: AWSDecodableShape {
        /// Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies if the trail has custom event selectors.
        public let hasCustomEventSelectors: Bool?
        /// Specifies whether a trail has insight types specified in an InsightSelector list.
        public let hasInsightSelectors: Bool?
        /// The region in which the trail was created.
        public let homeRegion: String?
        /// Set to True to include AWS API calls from AWS global services such as IAM. Otherwise, False.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists only in one region or exists in all regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Name of the trail set by calling CreateTrail. The maximum length is 128 characters.
        public let name: String?
        /// Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket Naming Requirements.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// Specifies the ARN of the trail. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, hasCustomEventSelectors: Bool? = nil, hasInsightSelectors: Bool? = nil, homeRegion: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.hasCustomEventSelectors = hasCustomEventSelectors
            self.hasInsightSelectors = hasInsightSelectors
            self.homeRegion = homeRegion
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case hasCustomEventSelectors = "HasCustomEventSelectors"
            case hasInsightSelectors = "HasInsightSelectors"
            case homeRegion = "HomeRegion"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case trailARN = "TrailARN"
        }
    }

    public struct TrailInfo: AWSDecodableShape {
        /// The AWS region in which a trail was created.
        public let homeRegion: String?
        /// The name of a trail.
        public let name: String?
        /// The ARN of a trail.
        public let trailARN: String?

        public init(homeRegion: String? = nil, name: String? = nil, trailARN: String? = nil) {
            self.homeRegion = homeRegion
            self.name = name
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case homeRegion = "HomeRegion"
            case name = "Name"
            case trailARN = "TrailARN"
        }
    }

    public struct UpdateTrailRequest: AWSEncodableShape {
        /// Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. Not required unless you specify CloudWatchLogsRoleArn.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether log file validation is enabled. The default is false.  When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail will not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
        public let enableLogFileValidation: Bool?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail applies only to the current region or to all regions. The default is false. If the trail exists only in the current region and this value is set to true, shadow trails (replications of the trail) will be created in the other regions. If the trail exists in all regions and this value is set to false, the trail will remain in the region where it was created, and its shadow trails in other regions will be deleted. As a best practice, consider using trails that log events in all regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is applied to all accounts in an organization in AWS Organizations, or only for the current AWS account. The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the master account for an organization in AWS Organizations. If the trail is not an organization trail and this is set to true, the trail will be created in all AWS accounts that belong to the organization. If the trail is an organization trail and this is set to false, the trail will remain in the current AWS account but be deleted from all member accounts in the organization.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. Examples:   alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:alias/MyAliasName   arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012   12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies the name of the trail or trail ARN. If Name is a trail name, the string must meet the following requirements:   Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)   Start with a letter or number, and end with a letter or number   Be between 3 and 128 characters   Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are invalid.   Not be in IP address format (for example, 192.168.5.4)   If Name is a trail ARN, it must be in the format:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let name: String
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket Naming Requirements.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters.
        public let s3KeyPrefix: String?
        /// Specifies the name of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.
        public let snsTopicName: String?

        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, enableLogFileValidation: Bool? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, name: String, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicName: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.enableLogFileValidation = enableLogFileValidation
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicName = snsTopicName
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case enableLogFileValidation = "EnableLogFileValidation"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicName = "SnsTopicName"
        }
    }

    public struct UpdateTrailResponse: AWSDecodableShape {
        /// Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered.
        public let cloudWatchLogsLogGroupArn: String?
        /// Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
        public let cloudWatchLogsRoleArn: String?
        /// Specifies whether the trail is publishing events from global services such as IAM to the log files.
        public let includeGlobalServiceEvents: Bool?
        /// Specifies whether the trail exists in one region or in all regions.
        public let isMultiRegionTrail: Bool?
        /// Specifies whether the trail is an organization trail.
        public let isOrganizationTrail: Bool?
        /// Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the format:  arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
        public let kmsKeyId: String?
        /// Specifies whether log file integrity validation is enabled.
        public let logFileValidationEnabled: Bool?
        /// Specifies the name of the trail.
        public let name: String?
        /// Specifies the name of the Amazon S3 bucket designated for publishing log files.
        public let s3BucketName: String?
        /// Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files.
        public let s3KeyPrefix: String?
        /// Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is:  arn:aws:sns:us-east-2:123456789012:MyTopic
        public let snsTopicARN: String?
        /// Specifies the ARN of the trail that was updated. The format of a trail ARN is:  arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail
        public let trailARN: String?

        public init(cloudWatchLogsLogGroupArn: String? = nil, cloudWatchLogsRoleArn: String? = nil, includeGlobalServiceEvents: Bool? = nil, isMultiRegionTrail: Bool? = nil, isOrganizationTrail: Bool? = nil, kmsKeyId: String? = nil, logFileValidationEnabled: Bool? = nil, name: String? = nil, s3BucketName: String? = nil, s3KeyPrefix: String? = nil, snsTopicARN: String? = nil, trailARN: String? = nil) {
            self.cloudWatchLogsLogGroupArn = cloudWatchLogsLogGroupArn
            self.cloudWatchLogsRoleArn = cloudWatchLogsRoleArn
            self.includeGlobalServiceEvents = includeGlobalServiceEvents
            self.isMultiRegionTrail = isMultiRegionTrail
            self.isOrganizationTrail = isOrganizationTrail
            self.kmsKeyId = kmsKeyId
            self.logFileValidationEnabled = logFileValidationEnabled
            self.name = name
            self.s3BucketName = s3BucketName
            self.s3KeyPrefix = s3KeyPrefix
            self.snsTopicARN = snsTopicARN
            self.trailARN = trailARN
        }

        private enum CodingKeys: String, CodingKey {
            case cloudWatchLogsLogGroupArn = "CloudWatchLogsLogGroupArn"
            case cloudWatchLogsRoleArn = "CloudWatchLogsRoleArn"
            case includeGlobalServiceEvents = "IncludeGlobalServiceEvents"
            case isMultiRegionTrail = "IsMultiRegionTrail"
            case isOrganizationTrail = "IsOrganizationTrail"
            case kmsKeyId = "KmsKeyId"
            case logFileValidationEnabled = "LogFileValidationEnabled"
            case name = "Name"
            case s3BucketName = "S3BucketName"
            case s3KeyPrefix = "S3KeyPrefix"
            case snsTopicARN = "SnsTopicARN"
            case trailARN = "TrailARN"
        }
    }
}
